package com.dream.inspect.common.utils;

import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.dream.inspect.modules.app.controller.common.CommonMethod;
import com.dream.inspect.modules.business.entity.Datas;
import com.zl.jwzh.yun.Xxzx;

public class SendMessageUtil {
	
	/**
	 * 接收第三方系统发送的消息，并存储到警综平台的消息中心
	 * 
	 * @param datas
	 * @return
	 */
	public static Datas sendMessage(Datas datas) {
		Datas resultData = new Datas();
		String xmlStr = JaxbObjectAndXmlUtil.object2Xml(datas);
		Xxzx xxzx = new Xxzx();
		String resultMsg = xxzx.sendMsg2016(xmlStr);
		if (StringUtils.isNotEmpty(resultMsg)) {
			resultData = JaxbObjectAndXmlUtil.xml2Object(resultMsg, Datas.class);
		}
		
		return resultData;
	}
	
	public static void main(String[] args) {
		Date utilDate= new Date();     
		Datas mb = new Datas();
    	mb.setRequestid("请求ID");
    	
    	mb.setTitle("标题");
    	mb.setContent("内容");
    	mb.setTsxx("提示信息");
    	mb.setIscl("处理状态");
    	mb.setIsdx("短信发送状态");
    	mb.setSjch("手机长号");
    	mb.setJjcd("紧急程度");
    	mb.setXxtyp("消息推送类型");
    	mb.setXxval("消息推送类型对应的内容");
    	mb.setOpenurl("打开路径");
    	mb.setOtherurl("其他打开路径");
    	mb.setType("10001");
    	mb.setCreateTime(utilDate);
    	mb.setUpdateTime(utilDate);
    	new CommonMethod().sendMessageAndInsertMessage(mb, "");
		String xml="";
		Xxzx xxzx = new Xxzx();
		xxzx.sendMsg2016(xml);

	}

}
 